Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lift non-immediate expressions out of case values for the Nockma backend #3010

Merged
merged 4 commits into from
Sep 9, 2024

Conversation

lukaszcz
Copy link
Collaborator

@lukaszcz lukaszcz commented Sep 9, 2024

Implements a transformation compute-case-anf which lifts out non-immediate values matched on in case expressions by introducing let-bindings for them. In essence, this is a partial ANF transformation for case expressions only.

For example, transforms

case f x of { c y := y + x; d y := y }

to

let z := f x in case z of { c y := y + x; d y := y }

This transformation is needed to avoid duplication of values matched on in case-expressions in the Nockma backend.

@lukaszcz lukaszcz merged commit 7167cb3 into main Sep 9, 2024
4 checks passed
@lukaszcz lukaszcz deleted the nockma-case-compilation branch September 9, 2024 12:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants